//
//  MineMoreViewController.m
//  YongChuanTradingArea
//
//  Created by Vivian on 2017/9/13.
//  Copyright © 2017年 李冰. All rights reserved.
//

#import "MineMoreViewController.h"
#import "MineAccountCell.h"
#import "MineNoticeViewController.h"

static NSString * const MineAccountCellID = @"MineAccountCell";

@interface MineMoreViewController ()

@property (nonatomic, strong) NSArray *titleArray;

@end

@implementation MineMoreViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"我的账户";
    [self setupArray];
    [self createUI];
    // Do any additional setup after loading the view.
}

- (void)setupArray{
    self.titleArray = @[@"使用帮助", @"公告列表", @"非WiFi下省流量使用", @"邀请好友", @"客服邮箱", @"客服电话", @"检查更新", @"关于我们"];
}

- (void)createUI{
    [self.view addSubview:self.tableView];
    self.tableView.frame = CGRectMake(0, 0, lbScreenWidth, lbScreenHeight-64);
    self.tableView.rowHeight = 54.5;
    self.tableView.scrollEnabled = NO;
    [self.tableView registerNib:[UINib nibWithNibName:MineAccountCellID bundle:nil] forCellReuseIdentifier:MineAccountCellID];
    self.tableView.separatorInset = UIEdgeInsetsMake(0, 12, 0, 0);
    self.tableView.separatorColor = [UIColor colorWithHexString:@"#dcdcdc"];
    
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return self.titleArray.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    MineAccountCell *cell = [tableView dequeueReusableCellWithIdentifier:MineAccountCellID forIndexPath:indexPath];
    if (indexPath.row == 2) {
        cell.sw.hidden = NO;
    }
    if (indexPath.row == 4) {
        cell.rightLabel.text = @"sdyg-kf@shengdianyungou.com";
    }
    if (indexPath.row == 5) {
        cell.rightLabel.text = @"400-775-5587";
    }
    if (indexPath.row == 6) {
        cell.rightLabel.text = @"当前版本 v2.0";
    }
    cell.titleLabel.text = self.titleArray[indexPath.row];
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.row == 0) {
        MineNoticeViewController * vc = [[MineNoticeViewController alloc]init];
        vc.msgType = @"2";
        [self.navigationController pushViewController:vc animated:YES];
    }
    if (indexPath.row == 1) {
        MineNoticeViewController * vc = [[MineNoticeViewController alloc]init];
        vc.msgType = @"1";
        [self.navigationController pushViewController:vc animated:YES];
    }
    if (indexPath.row == 2) {
  
    }
    if (indexPath.row == 3) {
     
    }
    if (indexPath.row == 4) {
        
    }
    if (indexPath.row == 5) {
        [LBTool callPhoneNumber:@"400-775-5587"];
    }
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
}

- (UIStatusBarStyle)preferredStatusBarStyle {
    
    return UIStatusBarStyleDefault;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
